/*
 * $Id: HelloUser.java 60 2013-01-03 15:16:06Z vladimirow@mail.ru $
 * $HeadURL: https://ultralog.googlecode.com/svn/ultralog/trunk/src-example/java/com/google/code/ultralog/example/HelloUser.java $
 *
 * This file is a part of ultralog project (http://code.google.com/p/ultralog/).
 * Released under New BSD License.
 */

import com.google.code.ultralog.BasicLogger;
import com.google.code.ultralog.LogMessage;
import com.google.code.ultralog.LoggerManager;

/**
 * Example that shows how to define parameterized log message.
 *
 * @author Mikhail Vladimirov
 */
public class HelloUser
{
    /**
     * Entry point of the example.
     *
     * @param args command-line arguments
     */
    public static void main (String [] args)
    {
        HelloLogger logger = LoggerManager.createLogger (HelloLogger.class);

        if (logger.isInfoEnabled ())
            logger.hello (System.getProperty ("user.name"));
    }

    /**
     * Logger interface that defines parameterized log message.
     */
    protected interface HelloLogger extends BasicLogger
    {
        /**
         * Logs parameterized message.
         *
         * @param user user name to be substituted into message
         */
        @LogMessage (level = INFO, template = "Hello, ${1}!")
        void hello (String user);
    }
}
